<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>axios</title>
</head>

<body>
    <script type="text/javascript" src="js/axios.js"></script>
    <script type="text/javascript">
        /*
            async/await 处理异步操作：
            async函数返回一个Promise实例对象
            await后面可以直接跟一个 Promise实例对象
        */
        async function queryData() {
            var ret = await new Promise(function (resolve, reject) {
                setTimeout(function () {
                    resolve("test");
                }, 1000);
            })
            return ret;
        }

        queryData().then(function (data) {
            console.log(data);
        })
    </script>
</body>

</html>